package pdm.traj.util.timeslot;

import java.util.Date;
import java.util.List;

public class FileTimeSlotMap {
	private String filePath;
	private int offset;
	private TimeSlot ts;
	
	public FileTimeSlotMap(String filePath, int offset, TimeSlot ts) {
		this.filePath = filePath;
		this.offset = offset;
		this.ts = ts;
	}
	
	public boolean inSlot(Date d) {
		return ts.inSlot(d);
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public TimeSlot getTs() {
		return ts;
	}

	public void setTs(TimeSlot ts) {
		this.ts = ts;
	}

	public int getOffset() {
		return offset;
	}

	public void setOffset(int offset) {
		this.offset = offset;
	}
	
	public String toString() {
		return filePath + "\t" + offset + "\t" + ts.toString(); 
	}
	
	public boolean eqauls(FileTimeSlotMap f) {
		return (this.filePath.equals(f.filePath) && this.offset == f.offset && this.ts.equals(f.ts));
	}
	
	public static boolean contains(List<FileTimeSlotMap> l, FileTimeSlotMap map) {
		for (FileTimeSlotMap tmp : l) {
			if (tmp.equals(map)) {
				return true;
			}
		}
		return false;
	}
}
